package com.github.tangmonkmeat;

import java.util.Scanner;

/**
 * Description:
 *
 * @author zwl
 * @version 1.0
 * @date 2021/8/21 下午9:32
 */
public class k个1的子串个数 {

    public static int NumSubString(int k, String str) {
        char[] chars = str.toCharArray();
        int res = 0;
        int len = chars.length;
        for (char aChar : chars) {
            if (aChar == '1') {
                res++;
            }
        }
        if (res < k) {
            return 0;
        }
        res = 0;
        for (int i = 0; i < len; i++) {
            /*滑动索引*/
            int index = i;
            int count = 0;
            while (count < k && index < len) {
                if (chars[index] == '1' && ++count == k) {
                    res++;
                    index++;
                    break;
                }
                index++;
            }
            /*满足k后继续右滑*/
            while (index < len && chars[index] != '1') {
                res++;
                index++;
            }
        }
        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        sc.nextLine();
        String str = sc.next();
        System.out.println(NumSubString(k,str));
    }
}
